package com.pzl.hwr.util;

import android.graphics.Paint;
import android.support.annotation.ColorInt;
import android.util.Log;

import com.sinovoice.hcicloudui.hwr.JTHwrPadView;

/**
 * Created by zl.peng on 2017/6/22 11:24.
 */

public class JTHwrPadViewUtil {

    static String TAG = "JTHwrPadViewUtil";


    public static void setBg(JTHwrPadView jtHwrPadView, @ColorInt int color) {
        ReflectionUtil.setFieldValue(jtHwrPadView, "p", color);
    }


    public static void setPathColor(JTHwrPadView jtHwrPadView, @ColorInt int color) {
        Paint paint = (Paint) ReflectionUtil.getFieldValue(jtHwrPadView, "c");
        Log.d(TAG, "get paint color = " + paint.getColor());
        paint.setColor(color);
        Log.d(TAG, "set paint color = " + paint.getColor());
    }

    public static void removeTopBottomText(JTHwrPadView jtHwrPadView) {
        Object a = ReflectionUtil.getFieldValue(jtHwrPadView, "w");
        String b = (String) ReflectionUtil.getFieldValue(a, "b");
        String c = (String) ReflectionUtil.getFieldValue(a, "c");
        Log.d(TAG, "b = " + b + ",c=" + c);
        ReflectionUtil.setFieldValue(a, "b", "");
        ReflectionUtil.setFieldValue(a, "c", "");
    }


}
